<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ taglib uri="/WEB-INF/tlds/att.tld" prefix="att"%>
<html>

<head> 
	<meta name="decorator" content="moduleEdit"/> 
	<script src="${staticPath}/lib/art-template/template.js"></script>
<script type="text/javascript"> 
	
	function submitForm(stauts){
		$("#status").val(stauts);
		statementInvoiceForm.submit();
		$('#approvalId').attr("disabled","true");
		$('#bacKId').attr("disabled","true");

	}
	
</script>

</head>
<body>
	<div class="Report_f">
           <div class="Report_f_1">
                <div class="Report_f_title_1">供应商发票审批</div>
                <ul class="nav nav-tabs Report_f_title_2">
                    <li><a href="#label_1" data-toggle="tab">基本信息</a></li>
                  </ul>
                  <!-- Tab panes -->
                  <div class="tab-content Report_f_title_3">
                    <div class="tab-pane active" id="label_1">
                         <div class="Report_f_title_4">
								<form:form id="statementInvoiceForm" name="statementInvoiceForm" modelAttribute="statementInvoice" action="${contextPath}/biz/statement/invoice/approval" method="post"
								   class="form-inline" role="form" onsubmit="return check()">
					           	   <form:hidden path="id"/>
					           	   <form:hidden path="status"/>
					           	   <form:hidden path="approvalDate"/>
					           	   <form:hidden path="approver"/>
					           	   <form:hidden path="supplierNo"/>
					               <form:hidden path="supplierName"/>
                                   <div class="f_3">
                                       <div class="form-group col-sm-6">
                                            <label for="inputtext3" class="col-sm-3 control-label f_4">供应商编号: </label>
                                            <div class="col-sm-9 f_6">
                                            	${statementInvoice.supplierNo}
                                            </div>
                                        </div>
                                        <div class="form-group col-sm-6">
                                            <label for="inputtext3" class="col-sm-3 control-label f_7">供应商名称:</label>
                                            <div class="col-sm-9 f_6">
                                            	${statementInvoice.supplierName}
                                            </div>
                                        </div>
                                   </div>
                                   <div class="f_2">
                                         <div class="form-group col-sm-6">
	                                             <label for="inputtext3" class="col-sm-4 control-label f_7">供应商合同号:</label>
	                                             <div class="col-sm-8 f_6">
	                                                  <div class="col-sm-7 f_14">
	                                                  	${statementInvoice.contractNumber}
	                                                  </div>
	                                             </div>
	                                         </div>
	                                         <div class="form-group col-sm-6">
	                                             <label for="inputtext3" class="col-sm-4 control-label f_7">结算单号:</label>
	                                             <div class="col-sm-8 f_6">
	                                                  <div class="col-sm-7 f_14">
	                                                  	${statementInvoice.billNo}
	                                                  </div>
	                                             </div>
	                                         </div>
                                        
                                    </div>
                                    <div class="f_3">
                                        <div class="form-group col-sm-6">
                                             <label for="inputtext3" class="col-sm-3 control-label f_4">结算开始日期:</label>
                                             <div class="col-sm-9 f_6">
                                            	 <div class="col-sm-7 f_14">
                                           			<fmt:formatDate value="${statementInvoice.startDate}" pattern="yyyy-MM-dd"/>
	                                            </div>
                                             </div>
                                         </div>
                                         <div class="form-group col-sm-6">
                                             <label for="inputtext3" class="col-sm-3 control-label f_7">结算结束日期:</label>
                                             <div class="col-sm-9 f_6">
                                            	 <div class="col-sm-7 f_14">
                                            	 	<fmt:formatDate value="${statementInvoice.endDate }" pattern="yyyy-MM-dd"/>
												 </div>
                                             </div>
                                         </div>
                                    </div>
                                   <div class="f_2">
                                       <div class="form-group col-sm-6">
                                            <label for="inputtext3" class="col-sm-3 control-label f_4">区域:</label>
                                            <div class="col-sm-9 f_6">
                                               <div class="input-group">
											        <ossp:select name="regionCode" value="${statementInvoice.regionCode}" service="selectOneRegionService" htmlEleProperties="disabled=\"disabled\""></ossp:select>
											    </div>
                                            </div>
                                        </div>
                                        <div class="form-group col-sm-6">
                                            <label for="inputtext3" class="col-sm-3 control-label f_7">分店:</label>
                                            <div class="col-sm-9 f_6">
                                               <div class="input-group">
											      <ossp:select name="shopCode" value="${statementInvoice.shopCode}" service="selectOneShopService" htmlEleProperties="disabled=\"disabled\""></ossp:select>
											    </div>
                                            </div>
                                        </div>
                                   </div>
                                    <div class="f_3">
                                        <div class="form-group col-sm-6">
                                            <label for="inputtext3" class="col-sm-3 control-label f_7">应开票金额:</label>
                                            <div class="col-sm-9 f_6">
                                           	 <div class="col-sm-7 f_14">
                                           	 		${statementInvoice.billingAmount} ¥
                                               </div>
                                            </div>
                                        </div>
                                        <div class="form-group col-sm-6">
                                             <label for="inputtext3" class="col-sm-3 control-label f_4">已开票金额:</label>
                                             <div class="col-sm-9 f_6">
                                            	 <div class="col-sm-7 f_14">
                                            	 	${statementInvoice.billedAmount} ¥
                                                </div>
                                             </div>
                                         </div>
                                    </div>
                                   <div class="f_2">
                                       <div class="form-group col-sm-6">
                                            <label for="inputtext3" class="col-sm-3 control-label f_4">税额:</label>
                                            <div class="col-sm-9 f_6">
                                           	 <div class="col-sm-7 f_14">
                                            	 	${statementInvoice.taxAmount} ¥
                                               </div>
                                            </div>
                                        </div>
                                        <div class="form-group col-sm-6">
                                            <label for="inputtext3" class="col-sm-3 control-label f_7">价税合计金额:</label>
                                            <div class="col-sm-9 f_6">
                                           	 <div class="col-sm-7 f_14">
                                           	 		${statementInvoice.totalAmount} ¥
                                               </div>
                                            </div>
                                        </div>
                                   </div>
                                    <div class="f_3">
                                         <div class="form-group col-sm-6">
                                             <label for="inputtext3" class="col-sm-3 control-label f_7">未开票金额:</label>
                                             <div class="col-sm-9 f_6">
                                            	 <div class="col-sm-7 f_14">
                                            	 	${statementInvoice.unbilledAmount} ¥
                                                </div>
                                             </div>
                                         </div>
                                         <div class="form-group col-sm-6">
                                             <label for="inputtext3" class="col-sm-3 control-label f_7">审批状态:</label>
                                             <div class="col-sm-9 f_6">
                                            	 <div class="col-sm-7 f_14">
                                            	 	<ossp:value dictType="approvalStatus" key="${statementInvoice.status}"></ossp:value>
                                                </div>
                                             </div>
                                         </div>
                                    </div>
                                    <div class="f_2">
										<h4>
											发票明细
										</h4>
										<table class="table table-striped o-l-table">
											<thead>
												<tr>
													<th style="width: 140px">发票代码</th>
													<th style="width: 120px">税率</th>
													<th style="width: 14%">价税合计金额</th>
													<th style="width: 12%">税额</th>
													<th style="width: 15%">联系电话</th>
													<th>备注</th>
												</tr>
											</thead>
											<tbody>
												<c:forEach items="${statementInvoice.invoiceDetailList}" var="itemCode" varStatus="var">
													<tr>
														<td>${itemCode.invoiceCode}</td>
														<td>${itemCode.taxRate} %</td>
														<td>${itemCode.totalAmount}</td>
														<td>${itemCode.taxAmount}</td>
														<td>${itemCode.contactNumber}</td>
														<td>${itemCode.remark}</td>
													</tr>
												</c:forEach>
											</tbody>
										</table>
									</div>
                                    <div class="f_3">
										<h4>
											审批
										</h4>
                                        <div class="form-group col-xs-12">
                                             <label for="inputtext3" class="col-lb-1 control-label f_10">审批意见：</label>
                                             <div class="col-sm-10 col-lb-2 f_6">
                                             		<form:textarea path="approvalOpinion" rows="3" cssClass="form-control f_11"/>
                                             </div>
                                         </div>
									</div>
                                   <div class="f_12">
                                   <c:if test="${statementInvoice.status=='20'}">
                                        <button type="button" id="bacKId" class="btn btn-warning btn_5 btn_right" onclick="submitForm('21')">驳&nbsp;回</button>
                                        <button type="button" id="approvalId" class="btn btn-success btn_5 btn_right" onclick="submitForm('30')">通&nbsp;过</button>
                                   </c:if>
                                   </div>
                              </form:form>
                         </div>
                    </div>
				  </div>
				</div>	
		</div>
<script id="mrow-tmp" type="text/html">
<tr data-row="content">
	<td>
		<input type="hidden" name="invoiceDetailList[{{index}}].taxRate" value="0.0">
		<input type="hidden" name="invoiceDetailList[{{index}}].invoiceId" value="${statementInvoice.id}">
		<input type="text" class="f_5" data-field="invoiceCode" name="invoiceDetailList[{{index}}].invoiceCode">
	</td>
	<td><ossp:select dictType="INVOICE_TAXCODE" name="invoiceDetailList[{{index}}].taxCode" isShowSelectTips="false" htmlEleProperties="onchange=\"recalculated(this)\""></ossp:select></td>
	<td><input type="text" class="f_5" data-field="totalAmount" name="invoiceDetailList[{{index}}].totalAmount" value="0.00" onchange="recalculated(this)"></td>
	<td><input type="text" class="f_5" data-field="taxAmount" name="invoiceDetailList[{{index}}].taxAmount" value="0.00" readonly="readonly"></td>
	<td><input type="text" class="f_5" name="invoiceDetailList[{{index}}].contactNumber"></td>
	<td><textarea rows="2" class="form-control f_11" name="invoiceDetailList[{{index}}].remark"></textarea></td>
	<td><input type="button" onclick="deleteRow(this,'#invoiceDetailTable')" value="删除" class="btn btn-default btn-sm"></td>
</tr>
</script>
</body>
</html>